<?php

namespace app\api\model;

use think\Model;

class Purchase extends Model
{
    protected $type = ['images' => 'json'];
    public function inStock()
    {
        return $this->hasMany(InStock::class, 'relation_id')->where('type', 1);
    }

//    public function outStock()
//    {
//
//    }

    public function relations()
    {
        return $this->hasMany(PurchaseRelation::class, 'pid');
    }
}
